﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

/// <summary>
/// TSysInfo2 的摘要说明
/// </summary>
public class TSysInfo2 : TData
{
    //常量
    const string CTableName = "t_sys_info2";
    const string CKeyName = "infoid";

    //与数据表字段对应的变量
    private string FInfoID;
    private string FTypeID;
    private string FInfoName;
    private string FIsShow;
    private decimal FOrderBy;

    //用于插入新记录
    public TSysInfo2()
    {
        FTableName = CTableName;
        FKeyName = CKeyName;
    }

    //用于直接update记录和获得记录值
    public TSysInfo2(string InfoID)
    {
        FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = InfoID;
    }

    //插入新记录。
    public void Insert()
    {
        string ExSql = "'" + FInfoID.ToUpper() + "','" + FTypeID.ToUpper() + "','" + FInfoName + "','" + FIsShow + "'," + FOrderBy.ToString();
        base.Insert(ExSql);
    }

    //更新记录。
    public void Update()
    {
        string ExSql = "infoname='" + FInfoName + "',isshow='" + FIsShow + "',orderby=" + FOrderBy.ToString();
        base.Update(ExSql);
    }

    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string InfoID)
    {
        TData.DeleteByID(InfoID, CTableName, CKeyName);
    }

    //根据TypeID获得记录值
    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {
            FInfoID = oDB["infoid"].ToString();
            FTypeID = oDB["typeid"].ToString();
            FInfoName = oDB["infoname"].ToString();
            FIsShow = oDB["isshow"].ToString();
            FOrderBy = oDB["orderby"].ToDecimal();
        }
        oDB.Free();
    }

    public string InfoID
    {
        get
        {
            return FInfoID;
        }
        set
        {
            FInfoID = value;
        }
    }

    public string TypeID
    {
        get
        {
            return FTypeID;
        }
        set
        {
            FTypeID = value;
        }
    }

    public string InfoName
    {
        get
        {
            return FInfoName;
        }
        set
        {
            FInfoName = value;
        }
    }

    public string IsShow
    {
        get
        {
            return FIsShow;
        }
        set
        {
            FIsShow = value;
        }
    }

    public decimal OrderBy
    {
        get
        {
            return FOrderBy;
        }
        set
        {
            FOrderBy = value;
        }
    }
}
